package com.gxa.ssm340.service.impl;

import com.gxa.ssm340.common.PageDTO;
import com.gxa.ssm340.entity.pojo.Brand;
import com.gxa.ssm340.mapper.BrandsMapper;
import com.gxa.ssm340.service.BrandsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author 叶骏
 * @description: TODO
 * @date 2023-10-23 18:27:07
 * @version: 1.0
 */
@Service
@Transactional(propagation = Propagation.REQUIRED)
public class BrandsServiceImpl implements BrandsService {
    @Autowired
    private BrandsMapper brandsMapper;
    @Override
    public List<Brand> getAll() {
        final List<Brand> all = brandsMapper.getAll();
        return all;
    }

    @Override
    public Integer add(Brand brand) {
        final Integer add = brandsMapper.add(brand);
        return add;
    }

    @Override
    public Integer delete(Integer id) {
        final Integer delete = brandsMapper.delete(id);
        return delete;
    }

    @Override
    public List<Brand> getByPage(PageDTO pageDTO) {
        final List<Brand> byPage = brandsMapper.getByPage(pageDTO);
        return byPage;
    }

    @Override
    public Integer count() {
        final Integer count = brandsMapper.count();
        return count;
    }
}
